/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Observable;

/**
 *
 * @author Irene
 */
public class Password extends Observable implements Serializable {

    private ArrayList<String> fitness;
    private ArrayList<String> work;
    private ArrayList<String> misc;
    private String title;
    private String username;
    private String password;

    public Password() {
        fitness = new ArrayList<String>();
        work = new ArrayList<String>();
        misc = new ArrayList<String>();

    }

    /*adds fitnesspassword to the arraylist fitness and notifies observer
     * @param title is the title of the password
     * @param username os the username for the password
     * @param password is the password
     */
    public void addFitnessPassword(String title, String username, String password) {
        this.title = title;
        this.username = username;
        this.password = password;
        String s = ("________________");
        String w = ("  *To What: *");
        String u = ("   *Username: *");
        String p = ("  *Password: *");
        fitness.add(w);
        fitness.add(title);
        fitness.add(u);
        fitness.add(username);
        fitness.add(p);
        fitness.add(password);
        fitness.add(s);
        setChanged();
        notifyObservers();

    }

    /*adds workpassword to the arraylist work and notifies observer
     * @param title is the title of the password
     * @param username os the username for the password
     * @param password is the password
     */
    public void addWorkPassword(String title, String username, String password) {
        this.title = title;
        this.username = username;
        this.password = password;
        String s = ("________________");
        String w = ("  *To What: *");
        String u = ("   *Username: *");
        String p = ("  *Password: *");
        work.add(w);
        work.add(title);
        work.add(u);
        work.add(username);
        work.add(p);
        work.add(password);
        work.add(s);
        setChanged();
        notifyObservers();
    }

    /*adds miscpassword to the arraylist misc and notifies observer
     * @param title is the title of the password
     * @param username os the username for the password
     * @param password is the password
     */
    public void addMiscPassword(String title, String username, String password) {
        this.title = title;
        this.username = username;
        this.password = password;
        String s = ("________________");
        String w = ("  *To What: *");
        String u = ("   *Username: *");
        String p = ("  *Password: *");
        misc.add(w);
        misc.add(title);
        misc.add(u);
        misc.add(username);
        misc.add(p);
        misc.add(password);
        misc.add(s);
        setChanged();
        notifyObservers();
    }

    /*Removes the fitnesspassword from the list fitness via a title
     * @param title is the list to be removed
     */
    public void removeFitnessPassword(String title) {
        this.title = title;
        fitness.remove(title);
        setChanged();
        notifyObservers();
    }

    public void removeWorkPassword(String title) {
        this.title = title;
        work.remove(title);
        setChanged();
        notifyObservers();
    }

    public void removeMiscPassword(String title) {
        this.title = title;
        misc.remove(title);
        setChanged();
        notifyObservers();
    }

    public ArrayList<String> getFitness() {
        return fitness;
    }

    public ArrayList<String> getMisc() {
        return misc;
    }

    public ArrayList<String> getWork() {
        return work;
    }
}